﻿<Page x:Class="WpfEffect3._5.PageBevelBitmapEffect"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
      mc:Ignorable="d"   Background="Black"
      d:DesignHeight="300" d:DesignWidth="800"
	Title="PageBevelBitmapEffect">
    <Page.Resources>
        <Style TargetType="TextBlock">
            <Setter Property="Foreground" Value="White" />
        </Style>
        <Style TargetType="RadioButton">
            <Setter Property="Foreground" Value="White" />
        </Style>
        
    </Page.Resources>
    <Canvas  >
        <TextBlock Canvas.Left="14" Canvas.Top="49" Height="21" Name="textBlock2" Text="宽度" Width="104" />
        <Slider AutoToolTipPlacement="BottomRight" AutoToolTipPrecision="1" Canvas.Left="128" Canvas.Top="48" 
                Value="{Binding ElementName=effect,Path=BevelWidth,Mode=TwoWay}"
                    Height="22" Interval="1" LargeChange="1" Maximum="20" Minimum="0" Name="sldBeleveWidth" ToolTip="BeleveWidth"   Width="312" />

        <TextBlock Canvas.Left="11" Canvas.Top="87" Height="21" Name="textBlock3" Text="光源方向" Width="70" />
        <Slider AutoToolTipPlacement="BottomRight" AutoToolTipPrecision="1" Canvas.Left="126" Canvas.Top="86" Height="22"
                    Interval="10" LargeChange="10" Maximum="360" Minimum="0" Name="sldLightAngle"  ToolTip="LightAngle"  
                Value="{Binding ElementName=effect,Path=LightAngle,Mode=TwoWay}" Width="312" />

        <TextBlock Canvas.Left="11" Canvas.Top="126" Height="22" Name="textBlock4" Text="起伏的高度" Width="109" />
        <Slider AutoToolTipPlacement="BottomRight" AutoToolTipPrecision="1" Canvas.Left="126" Canvas.Top="126" Height="22"
                  Value="{Binding ElementName=effect,Path=Relief,Mode=TwoWay}"
                    LargeChange="0.1" Maximum="1" Minimum="0" Name="sldRelief"   Width="312" ToolTip="Relief" />

        <TextBlock Canvas.Left="12" Canvas.Top="159" Height="21" Name="textBlock6" Text="平滑度" Width="106" />
        <Slider AutoToolTipPlacement="BottomRight" AutoToolTipPrecision="1" Canvas.Left="125" Canvas.Top="158" Height="22" ToolTip="Smoothness"
                  Value="{Binding ElementName=effect,Path=Smoothness,Mode=TwoWay}"
                    LargeChange="0.1" Maximum="1" Minimum="0" Name="sldSmoothness"  Width="312" />

        <Label Canvas.Left="6" Canvas.Top="186" Height="28" Name="label1" Width="86" ToolTip="EdgeProfile">效果曲线</Label>

        <RadioButton Canvas.Left="125" Canvas.Top="198" Height="16" Name="rbBulgedUp" Width="76"   GroupName="rbEdgeProfile">中空</RadioButton>
        <RadioButton Canvas.Left="207" Canvas.Top="198" Height="16" Name="rbCurvedIn" Width="72"   GroupName="rbEdgeProfile">内斜面</RadioButton>
        <RadioButton Canvas.Left="285" Canvas.Top="198" Height="16" Name="rbCurvedOut" Width="72"   GroupName="rbEdgeProfile">外斜面</RadioButton>
        <RadioButton Canvas.Left="367" Canvas.Top="198" Height="16" Name="rbLiner" Width="72"  IsChecked="True" GroupName="rbEdgeProfile">默认</RadioButton>
        <Image Canvas.Left="514" Canvas.Top="40" Height="150" Name="image2" Source="images/1.png" Stretch="Fill" Width="160">
            <Image.BitmapEffect>
                <BevelBitmapEffect x:Name="effect"  BevelWidth="20" Relief="0.4916943521594685" LightAngle="270.89700996677738" Smoothness="0.601328903654485" EdgeProfile="CurvedOut" />
            </Image.BitmapEffect>
        </Image>
        <TextBlock Canvas.Left="526" Canvas.Top="224" FontSize="40" Height="47" Name="textBlock1" Text="测试字" Width="181">
            <TextBlock.BitmapEffect>
                <BevelBitmapEffect BevelWidth="{Binding ElementName=effect,Path=BevelWidth,Mode=OneWay}" 
                                   EdgeProfile="{Binding ElementName=effect,Path=EdgeProfile,Mode=OneWay}" 
                                   LightAngle="{Binding ElementName=effect,Path=LightAngle,Mode=OneWay}" 
                                   Relief="{Binding ElementName=effect,Path=Relief,Mode=OneWay}" 
                                   Smoothness="{Binding ElementName=effect,Path=Smoothness,Mode=OneWay}" />
            </TextBlock.BitmapEffect></TextBlock>
        <TextBox Canvas.Left="14" Canvas.Top="224" Height="70" Name="textBox1" TextWrapping="Wrap" Width="412" />
        <TextBlock Canvas.Left="26" Canvas.Top="12" Height="23" Name="textBlock5" Text="凸凹效果" Width="331" />
    </Canvas>
</Page>
